package com.qcby.front.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qcby.framwork.utils.BeanCopyUtils;
import com.qcby.framwork.utils.ResponseResult;
import com.qcby.front.model.SgLink;
import com.qcby.front.dao.SgLinkMapper;
import com.qcby.front.service.SgLinkService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qcby.front.vo.LinkVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 友链 服务实现类
 * </p>
 *
 * @author admin
 * @since 2024-09-21
 */
@Service
public class SgLinkServiceImpl extends ServiceImpl<SgLinkMapper, SgLink> implements SgLinkService {

    @Override
    public ResponseResult getAllLink() {
        QueryWrapper<SgLink> queryWrapper=new QueryWrapper<>();
        //查询审核通过的友联,0代表通过
        queryWrapper.eq("status","0");
        List<SgLink> links=list(queryWrapper);
        //进行结果封装
        List<LinkVO> linkVOS= BeanCopyUtils.copyBeanList(links,LinkVO.class);
        return ResponseResult.okResult(linkVOS);
    }
}
